package interaction.game;

import processing.core.PImage;
import processing.core.PVector;

import java.awt.Rectangle;

public class DeathItem extends RandomForegroundItem {
	
	private static final int HITBOX_CONTRACTION = 30;
	
	public DeathItem(PImage image, PVector position, PVector velocity, int loopDistance, Hero hero) {
		super(image, position, velocity, loopDistance, hero);
	}

	public Rectangle getBounds() {
		Rectangle bounds = super.getBounds();
		bounds.setLocation(bounds.x + HITBOX_CONTRACTION, bounds.y + HITBOX_CONTRACTION);
		bounds.setSize(bounds.width - HITBOX_CONTRACTION * 2, bounds.height - HITBOX_CONTRACTION * 2);
		return bounds;
	}

	public void update(){
		super.update();
		if (intersectsWithHero()) {
			getHero().die();
		}
	}
}
